//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package org.quickserver.net.qsadmin.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class SimpleActionListener implements ActionListener {
    private SimpleCommand sm;
    private MainCommandPanel mcp;
    private QSAdminMain qsadminMain;

    public SimpleActionListener(QSAdminMain qsadminMain, SimpleCommand sm, MainCommandPanel mcp) {
        this.qsadminMain = qsadminMain;
        this.sm = sm;
        this.mcp = mcp;
    }

    public void actionPerformed(ActionEvent e) {
        Thread performer = new Thread(new Runnable() {
            public void run() {
                SimpleActionListener.this.sm.setTarget(SimpleActionListener.this.mcp.getTarget());
                boolean multiLine = SimpleActionListener.this.sm.getMultiLineResponse().equals("yes");
                if (SimpleActionListener.this.qsadminMain.getServerVersionNo() >= SimpleActionListener.this.sm.getVersionNo()) {
                    SimpleActionListener.this.qsadminMain.sendCommunication(SimpleActionListener.this.sm.getSimpleCommand(), multiLine, true);
                } else {
                    SimpleActionListener.this.qsadminMain.getGUI().setResponse("-ERR Host does not support this command");
                }

            }
        }, "QsAdminGUI-SimpleThread");
        performer.start();
    }
}
